<style lang="scss" scoped>
ul,
li {
  list-style: none;
}
.admin {
  width: 100%;
  overflow-x: hidden;
}
.el-header {
  background-color: #fff;
  color: #333;
  text-align: center;
  line-height: 60px;
  overflow: hidden;
  .el-menu--horizontal > .el-menu-item {
    color: #333333;
  }
  .el-menu-item {
    padding: 0;
    width: 16%;
  }
  .el-menu {
    display: flex;
    justify-content: center;
  }
  .logo {
    width: 170px;
    height: auto;
    margin-top: 14px;
  }
}
.el-footer {
  color: #333;
  text-align: center;
  height: auto !important;
}

.el-aside {
  color: #333;
  text-align: center;
}

.el-main {
  padding: 0;
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
  opacity: 0;
}
.myfooter {
  width: 960px;
  margin: auto;

  margin-bottom: 40px;
  text-align: left;
  .bewm {
    width: 120px;
    margin: auto;
  }
  h3,
  h2 {
    font-weight: normal;
    margin: 0;
    margin-top: 60px;
    margin-bottom: 20px;
  }
  h2 {
    margin-top: 46px;
    margin-bottom: 14px;
    cursor: pointer;
    text-align: center;
  }
  p {
    font-size: 14px;
    color: #adaeb3;
    cursor: pointer;
  }
  p:hover {
    color: #409eff;
  }
  .di {
    font-size: 12px;
    color: #adaeb3;
    margin-top: 4px;
    text-align: center;
  }
  .bts {
    margin-top: 14px;
    border-top: 1px solid rgba($color: #000, $alpha: 0.1);
    padding-top: 16px;
    text-align: left;
    color: #adaeb3;
    cursor: pointer;
  }
}
.bighead {
  height: 80px !important;
  .logo {
    width: 150px;
    // height: 40px;
    margin-top: 10px;
    margin-left: -100px;
    border-radius: 5px;
  }
}
.mmenu {
  overflow: hidden;
  margin-right: 40px;
  li {
    float: left;
    position: relative;
  }
  .arv {
    width: 42px;
    border-radius: 50%;
    margin-top: 6px;
    margin-left: 10px;
  }
  .mesa {
    margin-top: 10px;
  }
  .news{
    border-radius: 6px;
    padding: 0px 4px;
    background-color: #F56C6C;
    color: white;
    position: absolute;
    line-height: 16px;
    font-size: 10px;
    left: -14px;
    top:4px;
  }
  .pulld {
    margin-left: 10px;
    margin-top: 7px;
    .pulldz {
      font-size: 14px;
      color: #333;
    }
    .linh {
      line-height: 20px;
      text-align: left;
      position: relative;
      padding-right: 24px;
    }
    .lit {
      font-size: 12px;
      color: #aaa;
    }
    i {
      position: absolute;
      top: 12px;
      right: 0px;
      color: #aaa;
    }
  }
}
.lefn{
  padding: 0;
  text-align: left;
  h2{
    line-height: 50px;
    font-weight: normal;
    font-size: 18px;
    padding-left: 100px;
    margin: 0;
    position: relative;
    cursor: pointer;
    i{
      color: #999;
      font-size: 24px;
      position: absolute;
      left: 64px;
      top: 12px;
    }
  }
  li{
     position: relative;
     padding: 8px 0;
  }
  li:before{
    content: " ";
    position: absolute;
    bottom: 0;
    left: 98px;
    width: 43%;
    border-top: 1px solid #E4E8EB;
  }
  p{
    margin: 0;
    padding: 0;
    padding-left: 102px;
    line-height: 38px;
     cursor: pointer;
  }
  .h2:hover{
    background-color: rgb(241, 241, 241);
  }
  .p:hover{
     background-color: rgb(241, 241, 241);
  }
  .active{
    color: rgb(19, 120, 214);
    i{
      color: rgb(19, 120, 214);
    }
  }
}
</style>
<template>
  <div class="admin">
      <el-container style="height:100%;">
        <el-header class="bighead">
          <el-row>
            <el-col :span="6">
               <img class="logo" src="/static/img/logos.png" alt="">
            </el-col>
            <ul class="pull-right mmenu">
               <li @click="gourl('/message')">
                   <el-button  class="mesa" icon="el-icon-message"  circle></el-button>
                   <div class="news" v-if="infoSum>0">{{infoSum}}</div>
               </li>
                <li>
                 <img class="arv" :src="userInfo.avatarUrl" alt="">
               </li>
                <li class="pulld">
                  <el-dropdown >
                    <div class="el-dropdown-link">
                      <div class="linh">
                         <span class="pulldz"> {{userInfo.nickName}}</span>
                      </div>
                       <div class="linh lit">
                         {{userInfo.servicesType}}
                       </div>
                    </div>
                  </el-dropdown>
               </li>
            </ul>
          </el-row>
        </el-header>
         <el-container style="min-height:600px;margin-top:30px;">
          <el-aside width="250px">
            <ul class="lefn">
              <li v-for="(na,index) in navs" :key="index">
                <h2 @click="gourl(na.url,na.label)" :class="{active:na.url==leftnav,h2:na.url!=''}">
                  <i :class="na.icon"></i>{{na.label}}
                </h2>
                <div v-for="(n,index) in na.children" :key="index">
                  <p @click="gourl(n.url,n.label)" class="p" :class="{active:n.url==leftnav}">{{n.label}}</p>
                </div>
              </li>
            </ul>
          </el-aside>
          <el-main>  
            <transition name="fade" mode="out-in">
                  <router-view></router-view>
            </transition>
          </el-main>
        </el-container>
        <el-footer>
        <div class="myfooter">
            <div class="bts">Copyright © 2018-2025 贵州壹字码网络科技中心 yzema.com All Rights Reserved. 备案号：黔ICP备17007995号-1</div>
        </div>
        </el-footer>
    </el-container>

  </div>
</template>

<script>
export default {
  name: "home",
  data() {
    return {
      mainShow: true,
      activeName: "second",
      infoSum: 0,
      navs: [ 
        {
            "label" : "首页",
            "url" : "/admin",
            "icon" : "fa fa-home",
            "children" : []
        },
        {
            "label" : "图文",
            "url" : "",
            "icon" : "fa fa-graduation-cap",
            "children" : [ 
                {
                    "label" : "图文管理",
                    "url" : "/strategy"
                }, 
                {
                    "label" : "banner管理",
                    "url" : "/banner"
                }
            ]
        }, 
        {
            "label" : "管理",
            "url" : "",
            "icon" : "fa fa-user-circle",
            "children" : [ 
                {
                    "label" : "信息管理",
                    "url" : "/message"
                },
                {
                    "label" : "公司信息",
                    "url" : "/adminrevise"
                }
            ]
        }
      ],

    };
  },
  computed: {
    leftnav() {
      return this.$store.state.leftnav;
    },
    userInfo(){
      return this.$store.state.admin;
    }

  },
  mounted() {
    this.getlysum();
  },
  methods: {
    handleSelect(key, keyPath) {
      this.$store.commit("cactiveIndex", key);
    },
    gourl(url,label){
      if(url=='' || !url)return;
      this.$router.push(url)
    },
    async getlysum(){
      try {
        let result = await this.$http.get('/reply/lynewnum');
        if(result.status==200&&result.data.data==1){
          this.infoSum = result.data.sum;
        }
      } catch (error) {
        
      }
    },
    async goout() {
      try {
        let result = await this.$http.get('/admin/outlogin');
        if(result.data.data==1){
          this.getmessage(1,'登出')
          this.goto('/')
        }else{
          this.getmessage(2,'登出')
        }
      } catch (error) {
        
      }
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
